/**
 * 
 */
package com.globalresources.dao.hibernate;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.globalresources.dao.inface.IUserDao;
import com.globalresources.po.User;
import com.globalresources.po.DetailUser;
import com.trg.search.ExampleOptions;
import com.trg.search.Filter;
import com.trg.search.ISearch;
import com.trg.search.SearchResult;

/**
 * @author Administrator
 *
 */
public class UserDaoHibernateExtendHibernatedaoSupport extends HibernateDaoSupport  implements IUserDao {

	/* (non-Javadoc)
	 * @see com.globalresources.dao.inface.UserDao#countUsers(java.lang.String)
	 */
	public int countUsers(String username) {
		// TODO Auto-generated method stub
		return getHibernateTemplate().find("from User u where u.username like '%"+username+"%'").size();
	}

	/* (non-Javadoc)
	 * @see com.globalresources.dao.inface.UserDao#getUser(java.lang.String)
	 */
	public List<User> getUser(String username) {
		// TODO Auto-generated method stub		
		return getHibernateTemplate().find("from User u where u.username = '"+username+"'");
	}

	/* (non-Javadoc)
	 * @see com.globalresources.dao.inface.UserDao#getUsers(java.lang.String)
	 */
	public List<User> getUsers(String username) {
		// TODO Auto-generated method stub
		return getHibernateTemplate().find("from User u where u.username like '%"+username+"'%");
	}
	
	public User getUserById(String id) {
		// TODO Auto-generated method stub
		return (User)(getHibernateTemplate().find("from User u where u.id = '"+id+"'")).get(0);
	}

	

	/* (non-Javadoc)
	 * @see com.globalresources.dao.inface.UserDao#saveOrUpdateUser(com.globalresources.po.User)
	 */
	public void saveOrUpdateUser(User user) {
		// TODO Auto-generated method stub
		 getHibernateTemplate().saveOrUpdate(user);
	}

	/* (non-Javadoc)
	 * @see com.globalresources.dao.inface.UserDao#saveUser(com.globalresources.po.User)
	 */
	public void saveUser(User user) {
		// TODO Auto-generated method stub
		getHibernateTemplate().save(user);
	}
	
	/* (non-Javadoc)
	 * @see com.globalresources.dao.inface.UserDao#saveUser(com.globalresources.po.User)
	 */
	public void saveDetailUser(DetailUser detailuser) {
		// TODO Auto-generated method stub
		getHibernateTemplate().save(detailuser);
	}

	public List<User> getUsers(String[] usernames) {
		// TODO Auto-generated method stub
		return null;
	}

	public int count(ISearch arg0) {
		// TODO Auto-generated method stub
		return 0;
	}

	public User find(Integer arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	public User[] find(Integer... arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	public List<User> findAll() {
		// TODO Auto-generated method stub
		return null;
	}

	public void flush() {
		// TODO Auto-generated method stub
		
	}

	public Filter getFilterFromExample(User arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	public Filter getFilterFromExample(User arg0, ExampleOptions arg1) {
		// TODO Auto-generated method stub
		return null;
	}

	public User getReference(Integer arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	public User[] getReferences(Integer... arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	public boolean isAttached(User arg0) {
		// TODO Auto-generated method stub
		return false;
	}

	public void refresh(User... arg0) {
		// TODO Auto-generated method stub
		
	}

	public boolean remove(User arg0) {
		// TODO Auto-generated method stub
		return false;
	}

	public void remove(User... arg0) {
		// TODO Auto-generated method stub
		
	}

	public boolean removeById(Integer arg0) {
		// TODO Auto-generated method stub
		return false;
	}

	public void removeByIds(Integer... arg0) {
		// TODO Auto-generated method stub
		
	}

	public boolean save(User arg0) {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean[] save(User... arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	public List<User> search(ISearch arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	public SearchResult<User> searchAndCount(ISearch arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	public List searchGeneric(ISearch arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	public User searchUnique(ISearch arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	public Object searchUniqueGeneric(ISearch arg0) {
		// TODO Auto-generated method stub
		return null;
	}

}
